{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">会员订单</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('vip_order/add')}"
                   data-auth-edit="{:$auth->check('vip_order/edit')}"
                   data-auth-delete="{:$auth->check('vip_order/del')}"
                   data-auth-recyclebin="{:$auth->check('vip_order/recyclebin')}"
            ></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
            modify_url: "{:url('multi')}",
            recyclebin_url: "{:url('recyclebin')}",
        };
        var vip = <?php echo $vip; ?>;

        table.render({
            init: init,
            toolbar: ['refresh', 'delete'],
            url: '{:url("index")}',
            cols: [
                [
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'member_id', title: '用户ID', minWidth: 80},
                    {field: 'out_trade_no', align: 'center', title: '订单编号', searchOp: 'LIKE', minWidth: 170},
                    {field: 'member.nickname', align: 'center', title: '昵称', minWidth: 120, searchOp: 'LIKE'},

                    {field: 'pay_amount', align: 'center', title: '支付金额', minWidth: 120, search:false},

                    {
                        field: 'vip_cate_name',
                        align: 'center',
                        title: '会员分组',
                        minWidth: 100,
                        templet: yznTable.formatter.label,
                        selectList: {1: '1类会员', 2: '2类会员', 3: '3类会员'}
                    },
                    {
                        field: 'vip_name',
                        align: 'center',
                        title: 'VIP名称',
                        fieldAlias:'vip_id',
                        minWidth: 110,
                        templet: yznTable.formatter.label,
                        selectList: vip
                    },
                    {
                        field: 'vip_type',
                        align: 'center',
                        title: 'VIP时效',
                        search: false,
                        minWidth: 80,
                        searchOp: 'LIKE',
                        minWidth: 110
                    },
                    {
                        field: 'vip_expire_time_text',
                        align: 'center',
                        title: '到期时间',
                        search: false,
                        minWidth: 200
                    },
                    {
                        field: 'status',
                        align: 'center',
                        width: 120,
                        title: '状态',
                        templet: yznTable.formatter.status,
                        selectList: {
                            0: '待支付',
                            1: '支付成功',
                            2: '支付失败',
                        },
                    },
                    {
                        field: 'create_time',
                        title: '创建时间',
                        minWidth: 80,
                        width: 180,
                        search: false,
                        templet: yznTable.formatter.datetime
                    },
                    {
                        field: 'pay_time',
                        title: '支付时间',
                        minWidth: 80,
                        width: 180,
                        search: 'range',
                        templet: yznTable.formatter.datetime
                    },
                    {
                        fixed: 'right',
                        width: 90,
                        search: false,
                        field: 'operate',
                        title: '操作',
                        templet: yznTable.formatter.tool,
                        operat: ['delete']
                    }
                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}